package web.telnet;

import java.io.IOException;
import java.util.*;
import java.net.Socket;

public class SocketTest {
    public static void main(String[] args) throws IOException {
        try (
                Socket socket = new Socket("time-a.nist.gov", 13);
                Scanner scanner = new Scanner(socket.getInputStream())) {
            while (scanner.hasNextLine()) {
                System.out.println(scanner.nextLine());
            }
            scanner.close();
        }
    }
}
